package com.wk.ums.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wk.common.bean.Resp;
import com.wk.ums.entity.MemberReceiveAddress;
import com.wk.ums.service.MemberReceiveAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/memberReceiveAddress")
public class MemberReceiveAddressController {

    @Autowired
    private MemberReceiveAddressService  memberReceiveAddressService;

    /**
     * 根据用户ID查询对应的收货地址列表
     */
    @GetMapping("{userId}")
    public Resp<List<MemberReceiveAddress>> queryByUserId(@PathVariable(value = "userId") Long userId){
        return Resp.ok(memberReceiveAddressService.list(new QueryWrapper<MemberReceiveAddress>().eq("member_id",userId)));
    }
}

